﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using SeaBattle.Domain.RepositoryFactory;
using SeaBattle.UI.Web.Models;

namespace SeaBattle.UI.Web.Controllers
{
    public class RoomController : Controller
    {
        //
        // GET: /Room/
        [Authorize]
        public ActionResult Index()
        {
            // Get player's account instance
            var playerService = PlayerFactory.CreatePlayerService();
            var player = playerService.GetPlayer(User.Identity.Name);
            // Ask the account for the balance value
            var accountService = AccountFactory.CreateAccountService();
            var balance = accountService.GetPlayerBalance(player);
            return View(new RoomViewModel{ PlayerAccountBalance = balance});
        }

    }
}
